from ..core import Tabulation, Constant
import keyboard


class SingleBox(Tabulation):
    def run(self):
        self.render(0)
        keyboard.add_hotkey(Constant.DOWN, self.handle_down)
        keyboard.add_hotkey(Constant.UP, self.handle_up)
        if self.page_size != 0:
            keyboard.add_hotkey(Constant.LEFT, self.handle_left)
            keyboard.add_hotkey(Constant.RIGHT, self.handle_right)
        keyboard.wait(Constant.CTRL)
        res = {f'{self.name}': self.current_value}
        self.handle_off()
        return res
